//
//  YTKUploadImageApi.m
//  AF3.0WithYTK
//
//  Created by tianXin on 16/10/28.
//  Copyright © 2016年 陕西百益软件有限公司. All rights reserved.
//

#import "YTKUploadImageApi.h"

@implementation YTKUploadImageApi {
    UIImage *_image;
    NSString *_imageName;
    NSString *_format;
    CGSize _imageSize;
}
- (instancetype)initWithImageName:(NSString *)imageName format:(NSString *)format image:(UIImage *)image {
    self = [super init];
    if (self) {
        _imageName = imageName;
        _format = format;
        _imageSize = image.size;
        _image = image;
    }
    return self;
}
- (NSString *)requestUrl {
    return @"";
}



- (YTKRequestSerializerType)requestSerializerType {
    return YTKRequestSerializerTypeHTTP;
}
- (YTKRequestMethod)requestMethod {
    return YTKRequestMethodPOST;
}
- (AFConstructingBlock)constructingBodyBlock {
    return ^(id<AFMultipartFormData> formData) {
        NSData *imageData = UIImageJPEGRepresentation(_image, .8);
        [formData appendPartWithFileData:imageData name:@"avatar" fileName:@"avatar.jpeg" mimeType:@"image/jpeg"];
    };
}
- (id)requestArgument {
    return @{};
}
@end
